#pragma once

class CLocalFile:
	public IDownLoadTask,
	public IDownLoadTaskEx , 
	private CUnknownImp
{
public:

	UNKNOWN_IMP2_(IDownLoadTask,IDownLoadTaskEx);
	STDMETHOD(init_class)(IMSBase* pRot , IMSBase* pOuter)
	{
		RASSERT(pRot , E_INVALIDARG);
		m_pRot = pRot;
		return S_OK;
	}

	CLocalFile(void);
	~CLocalFile(void);

	STDMETHOD(Init)();
	STDMETHOD(Uninit)();

	STDMETHOD(SetDownloadInfo)(const download_info& info);
	STDMETHOD(StartDownload)(LPCWSTR lpszUrl,  OUT sha1_hash& urlhash ,DSType dsType = DS_Unknow, BOOL bCheckExist = FALSE);

	STDMETHOD(Pause)       () ;  
	STDMETHOD(Resume)      () ;	
	STDMETHOD(Stop)        (BOOL remove_files = FALSE) ;
	STDMETHOD(GetStat)     (StateMessageID statid, void* data, int nlen) ;
	STDMETHOD(SetStat)     (StateMessageID statid, void* data, int nlen) ;

	STDMETHOD(GetShareFile)(IShareFile**pFileRead) ;

private:
	UTIL::com_ptr<IMscomRunningObjectTable> m_pRot;
	UTIL::com_ptr<IDownLoadTaskPoint>       m_pCallBack;
};
